package com.qianren.edu.exception;

import org.springframework.dao.DataAccessException;

public class CoreException extends DataAccessException {

	private static final long serialVersionUID = 1375245753937771901L;

	public static final int TYPE_COMPANY_NAME_EXISTS = 1;
	public static final int TYPE_COMPANY_ID_EXISTS = 2;
	public static final int TYPE_EMPLOYEE_USERID_EXISTS = 3;
	public static final int TYPE_EMPLOYEE_NOTFOUND = 10;
	public static final int TYPE_DEPARTMENT_NOTFOUND = 11;
	public static final int TYPE_DEPARTMENT_CHILDREN_EXISTS = 12;
	public static final int TYPE_DATABASE = 4;
	public static final int TYPE_FREEMARKER = 5;
	public static final int TYPE_CONFIRM_ERROR = 6;
	public static final int TYPE_CONFIRM_DONE = 7;
	public static final int TYPE_CONFIRM_CHANGED = 8;
	public static final int TYPE_DEPARTMENT_TITLE_EXISTS = 9;
	public static final int TYPE_OTHERS = 999;

	private int type;

	private String message;

	public CoreException(int type) {
		super("CoreException:type = " + type);
		this.type = type;
	}

	public CoreException(int type, Exception e) {
		super("type=" + type, e);
		this.type = type;
	}

	public CoreException(String message) {
		super(message);
		this.message = message;
	}

	public CoreException(String message, Exception e) {
		super(message, e);
		this.message = message;
	}

	public CoreException(int type, String message) {
		super(message);
		this.message = message;
		this.type = type;
	}

	public int getType() {
		return type;
	}

	public String getMessage() {
		return message;
	}

}
